<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增申请开票')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-sqkp-add">
        	<h4 class="form-header h4">开票详情</h4>
        	<input type="hidden" name="gcProjectid" id="gcProjectid" th:value="${gcProject.id}">
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">项目编号：</label>
                <div class="col-sm-4">
                    <input name="orderNo" class="form-control" type="text" autoComplete="off" th:value="${gcProjectXmxq.orderNo}" readonly="readonly" required>
                </div>
                <label class="col-sm-2 control-label is-required">申请时间：</label>
                <div class="col-sm-4">
                    <div class="input-group date">
                        <input name="sqsj" class="form-control" placeholder="yyyy-MM-dd" type="text" autoComplete="off" required th:value="${#dates.format(sqsj, 'yyyy-MM-dd')}">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">项目名称：</label>
                <div class="col-sm-4">
                    <input name="xmmc" class="form-control" type="text" autoComplete="off" th:value="${gcProjectXmxq.xmmc}" readonly="readonly" required>
                </div>
<!--                 <label class="col-sm-2 control-label is-required">项目地址：</label> -->
<!--                 <div class="col-sm-4"> -->
<!--                     <input name="xmdz" class="form-control" type="text" autoComplete="off" th:value="${gcProjectXmxq.xmdz}" required> -->
<!--                 </div> -->
				<label class="col-sm-2 control-label is-required">项目类型：</label>
                <div class="col-sm-4">
		            <select name="xmlx" class="form-control" th:with="type=${@dict.getType('gcgl_project_type')}" required>
		                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
		            </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">合同金额：</label>
                <div class="col-sm-4">
                    <input name="htje" class="form-control" type="text" autoComplete="off" th:value="${gcProjectXmxq.htje}" readonly="readonly" required>
                </div>
                <label class="col-sm-2 control-label is-required">发票类型：</label>
                <div class="col-sm-4">
                    <select name="fplx" class="form-control" th:with="type=${@dict.getType('gcgl_project_fp')}" required>
		                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
		            </select>
                </div>
            </div>
<!--             <div class="form-group">     -->
<!--                 <label class="col-sm-2 control-label is-required">本次申请开票金额：</label> -->
<!--                 <div class="col-sm-4"> -->
<!--                     <input name="bcsqkpje" id="bcsqkpje" class="form-control" type="text" autoComplete="off" onchange="getHjje()" required> -->
<!--                 </div> -->
<!--                 <label class="col-sm-2 control-label is-required">预计收款金额：</label> -->
<!--                 <div class="col-sm-4"> -->
<!--                     <input name="yjskje" class="form-control" type="text" autoComplete="off" required> -->
<!--                 </div> -->
<!--             </div> -->
            <div class="form-group"> 
            	<label class="col-sm-2 control-label is-required">单位名称/税号：</label>
                <div class="col-sm-4">
                    <input name="shuih" class="form-control" type="text" autoComplete="off" th:value="${shuih}" readonly="readonly" required>
                </div>   
                
                
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">单位开户行/帐号：</label>
                <div class="col-sm-4">
                    <input name="kaihuh" class="form-control" type="text" autoComplete="off" th:value="${kaihuh}" readonly="readonly" required>
                </div>
                <label class="col-sm-2 control-label is-required">单位地址/电话：</label>
                <div class="col-sm-4">
                    <input name="dizhi" class="form-control" type="text" autoComplete="off" th:value="${dizhi}" readonly="readonly" required>
                </div>
            </div>
            <div class="form-group">    
<!--                 <label class="col-sm-2 control-label">已开发票时间：</label> -->
<!--                 <div class="col-sm-4"> -->
<!--                     <div class="input-group date"> -->
<!--                         <input name="ykfpsj" class="form-control"  th:value="${ykfpsj}" placeholder="yyyy-MM-dd" type="text" autoComplete="off"> -->
<!--                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span> -->
<!--                     </div> -->
<!--                 </div> -->
				<label class="col-sm-2 control-label is-required">本次申请开票金额：</label>
                <div class="col-sm-4">
                    <input name="itemje" id="itemje" class="form-control" type="text" autoComplete="off" onchange="getHjje()" required>
                </div>
                <label class="col-sm-2 control-label">已开发票金额：</label>
                <div class="col-sm-4">
                    <input name="ykfpje" id="ykfpje" class="form-control" type="text" autoComplete="off" th:value="${ykfpje}" readonly="readonly">
                </div>
                
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">发票内容：</label>
                <div class="col-sm-4">
                    <input name="itemmc" class="form-control" type="text" autoComplete="off" required>
                </div>
                <label class="col-sm-2 control-label is-required">建筑项目名称（与合同一致）：</label>
                <div class="col-sm-4">
                    <input name="pname" class="form-control" type="text" autoComplete="off" required >
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">税率：</label>
                <div class="col-sm-4">
                    <select name="itemsl" class="form-control" th:value="${gcProjectXmxq.kpsl}">
		                <option th:value="9">9%</option>
		                <option th:value="6">6%</option>
		                <option th:value="3">3%</option>
		                <option th:value="1">1%</option>
		                <option th:value="0">0%</option>
		                <option th:value="11">11%</option>
		                <option th:value="13">13%</option>
		            </select>
                </div>
                <label class="col-sm-2 control-label is-required">建筑服务发生地（项目地址）：</label>
                <div class="col-sm-4">
                    <input name="itemgg" class="form-control" type="text" autoComplete="off" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">合计(累计开票金额)：</label>
                <div class="col-sm-4">
                    <input name="hej" id="hej" class="form-control" type="text" autoComplete="off" required readonly="readonly">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">备注：</label>
                <div class="col-sm-10">
                    <textarea name="memo" class="form-control"></textarea>
                </div>
            </div>
        </form>
        	<h4 class="form-header h4" style="margin-top: 25px;">历史开票信息</h4>
            <div class="form-group">
                <div class="col-sm-12" th:each="lis,status:${sqkplis}">
                	<span>开票金额：</span>
                	<span th:text="${lis.itemje}">&nbsp;</span>
                	<span>&nbsp;&nbsp;申请时间：</span>
                	<span th:text="${lis.createUser}">&nbsp;</span>
                </div>
            </div>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "gcgl/sqkp";
        var hej = 0;
        $("#form-sqkp-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/add", $('#form-sqkp-add').serialize());
            }
        }
        
        function getHjje(){
        	console.log($("#itemje").val());
        	console.log($("#ykfpje").val());
        	//hej = math.add($("#itemje").val(),$("#ykfpje").val());
        	hej = parseFloat($("#itemje").val())+parseFloat($("#ykfpje").val());
        	$("#hej").val(hej);
        }

        $("input[name='sqsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='xmfzrAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='ykfpsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='cwkprAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='zjlspAt']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

    </script>
</body>
</html>